package com.object.module.lq.sys.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import com.object.lq.utile.Constructor;
import com.object.lq.utile.VueConstructor;
import com.object.module.lq.sys.service.TTableService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.sql.SQLException;

@RestController
@RequestMapping("/testRole")
public class TTestRole {

    // @SaCheckRole("sysUser")
    @GetMapping("index")
    public String index() {
        return "我进来了。。。";
    }

    @SaCheckPermission("-read")
    @GetMapping("login/{id}")
    public String login(@PathVariable("id") Long id) {
        StpUtil.login(id);
        return StpUtil.getTokenValue();
    }

    @Resource
    private VueConstructor vueConstructor;
    @Resource
    private TTableService tTableService;


    @Resource
    private Constructor constructor;
    @GetMapping("/test")
    public void test(HttpServletResponse response) throws SQLException {
     //  vueConstructor.contextLoads(response,"t_user","用户","", path);
      //  constructor.generate("t_user","testUser");

      // System.out.println(tTableService.list(new HashMap<>()).getData());
    }
}
